﻿using Clover.BaseAuth;
using Clover.Demo.App_Start;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Clover.Demo.Filters
{
    public class PermissionAttribute : Attribute, IPermissionAttribute
    {
        public Enum[] Permissions { get; set ; }

        public PermissionAttribute(PermissionConfig permission) {
            Permissions = new Enum[] { permission };
        }

        public PermissionAttribute(PermissionConfig permission, PermissionConfig permission1)
        {
            Permissions = new Enum[] { permission, permission1 };
        }

        public PermissionAttribute(PermissionConfig permission, PermissionConfig permission1 , PermissionConfig permission2)
        {
            Permissions = new Enum[] { permission, permission1 ,permission2};
        }
        public PermissionAttribute(params PermissionConfig[] permissions)
        {
            Permissions= Enumerable.Empty<PermissionConfig>().Concat(permissions).Cast<Enum>().ToArray();
        }
    }
}